package DAO;

import DAO.impl.GoodDAOImpl;
import DAO.impl.UserDAOImpl;

public class Factory {

    private static IGoodDAO goodDAO = null;
    private static IUserDAO userDAO = null;
    private static Factory instance = null;

    public static synchronized Factory getInstance(){
        if (instance == null){
            instance = new Factory();
        }
        return instance;
    }

    public IGoodDAO getGoodDAO(){
        if (goodDAO == null){
            goodDAO = new GoodDAOImpl();
        }
        return goodDAO;
    }

    public IUserDAO getUserDAO() {
        if(userDAO == null){
            userDAO = new UserDAOImpl();
        }
        return userDAO;
    }
}


